package com.hzlj.position.job.job;

import com.fz.common.redis.annotation.SyncLock;
import com.hzlj.position.locate.service.ReportInspectionSyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class ReportInspectionAutoJob {
    @Resource
    private ReportInspectionSyncService reportInspectionSyncService;

    /**
     * 凌晨执行
     */
    @SyncLock(lockMs = 60000)
    @Scheduled(cron = "${job.report.auto.sync:0 0 * * * ?}")
    public void sync() {
        long start = System.currentTimeMillis();
        log.info("任务开始执行[自动点验同步]");
        Integer size = reportInspectionSyncService.syncReportInspectionAuto();
        log.info("任务结束执行[自动点验同步],size={},cost={}", size, System.currentTimeMillis() - start);
    }
}
